package net.sf.rose.business.bean.base;

import org.apache.commons.lang.StringUtils;

import net.sf.rose.jdbc.UserBean;
import net.sf.rose.jdbc.annotation.Column;
import net.sf.rose.jdbc.annotation.Id;
import net.sf.rose.jdbc.annotation.Table;

/**
 * 用户数据类
 * @author fengjian
 * @since 2014/03/18
 */
@Table(name = "SYS_USER")
public class User extends UserBean {

	/** 用户编号 */
	@Id
	@Column(name = "USER_ID")
	private String userID = null;

	/** 用户名 */
	@Column(name = "USER_NAME")
	private String userName = null;

	/** 用户姓名 */
	@Column(name = "REAL_NAME")
	private String realName = null;

	/** 上次登录时间 */
	@Column(name = "LAST_LOGIN_TIME")
	private java.sql.Timestamp lastLoginTime = null;

	/** 工作组 */
	@Column(name = "GROUPS")
	private String groups = null;

	/** 角色 */
	@Column(name = "ROLES")
	private String roles = null;

	@Column(name = "CREATE_USER")
	private String createUser = null;

	@Column(name = "CREATE_TIME")
	private java.sql.Timestamp createTime = null;

	@Column(name = "UPDATE_USER")
	private String updateUser = null;

	@Column(name = "UPDATE_TIME")
	private java.sql.Timestamp updateTime = null;

	public String getUserID() {
		return userID;
	}

	public void setUserID(String userID) {
		this.userID = userID;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public java.sql.Timestamp getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(java.sql.Timestamp lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public String getGroups() {
		return groups;
	}

	public void setGroups(String groups) {
		this.groups = groups;
	}

	public String[] getGroupArray() {
		if (groups == null) {
			return new String[0];
		} else {
			if (groups.indexOf(',') == -1) {
				return new String[] { groups };
			} else {
				return StringUtils.split(groups, ',');
			}
		}
	}

	public String getRoles() {
		return roles;
	}

	public String[] getRoleArray() {
		if (roles == null) {
			return new String[0];
		} else {
			if (roles.indexOf(',') == -1) {
				return new String[] { roles };
			} else {
				return StringUtils.split(roles, ',');
			}
		}
	}

	public void setRoles(String roles) {
		this.roles = roles;
	}

	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public java.sql.Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	public java.sql.Timestamp getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(java.sql.Timestamp updateTime) {
		this.updateTime = updateTime;
	}

}
